const Mock = require('mockjs')
const img = [
  'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fww1.sinaimg.cn%2Fmw690%2F001M3Mcbly1gjvrssaex7j63n83n8kjp02.jpg&refer=http%3A%2F%2Fwww.sina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611919354&t=9d65fb759c1945e1242b51e0bf9a060f',
  'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3155998395,3600507640&fm=26&gp=0.jpg',
  'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201510%2F18%2F20151018172940_5etXi.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611919469&t=83461f38906839d3b52c2e7a51ed739a',
  'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1441836571,2166773131&fm=26&gp=0.jpg',
  'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3582194852,1481557220&fm=26&gp=0.jpg',
  'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fblog%2F202011%2F16%2F20201116144255_fbec6.thumb.1000_0.jpeg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611919644&t=7b51260d1f5500038fda227f06888cdb',
  'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2315146696,3189809923&fm=26&gp=0.jpg',
  'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201501%2F30%2F20150130004848_UTsAu.thumb.700_0.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611919699&t=e6dd0e941e8bc9a719aa0eccd11797a4',
  'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1074188057,1218579293&fm=26&gp=0.jpg',
  'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1950846641,3729028697&fm=26&gp=0.jpg',
  'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=347107276,1959396700&fm=11&gp=0.jpg',
  'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=289237221,199580710&fm=26&gp=0.jpg',
  'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E5%A4%B4%E5%83%8F&step_word=&hs=0&pn=387&spn=0&di=213620&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=208155123%2C970589869&os=3884857991%2C203103760&simid=3441860545%2C171948184&adpicid=0&lpn=0&ln=30&fr=&fmq=1609327339494_R&fm=&ic=undefined&s=undefined&hd=undefined&latest=undefined&copyright=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=head&bdtype=0&oriquery=%E5%A4%B4%E5%83%8F&objurl=https%3A%2F%2Fgimg2.baidu.com%2Fimage_search%2Fsrc%3Dhttp%3A%2F%2Fpic1.zhimg.com%2F50%2Fv2-1ae9b2bbc17daaeb0a5d12184063a30f_hd.jpg%26refer%3Dhttp%3A%2F%2Fpic1.zhimg.com%26app%3D2002%26size%3Df9999%2C10000%26q%3Da80%26n%3D0%26g%3D0n%26fmt%3Djpeg%3Fsec%3D1611919811%26t%3D552e6899171237ac252b2bfa98044028&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bziti7_z%26e3Bv54AzdH3Fq7jfpt5gAzdH3Fn8anncm8bAzdH3Fwgfoj6AzdH3Fmdbdb8b99&gsm=184&rpstart=0&rpnum=0&islist=&querylist=&force=undefined',
  'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1340127580,1407454083&fm=26&gp=0.jpg',
  'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1296984525,3378929106&fm=26&gp=0.jpg',
  'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3033361221,2752676077&fm=26&gp=0.jpg',
  'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2541308253,3190372927&fm=26&gp=0.jpg',
  'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1878145874,2802724191&fm=26&gp=0.jpg',
  'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2292908988,3239045523&fm=26&gp=0.jpg',
  'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1365983964,600966652&fm=26&gp=0.jpg'
]
module.exports = {
  // 登录
  [`POST /app/login`](req, res) {
    res.status(200).json(Mock.mock({
      "status": 200,
      "data": {
        token: "@word(30, 60)",
        refresh_token: "@word(30, 60)"
      }
    }));
  },


  // 获取用户个人资料
  [`GET /app/user/profile`](req, res) {
    res.status(200).json(Mock.mock({
      message: '获取用户个人信息成功',
      data: {
        "id|1-9999": 1,
        "name": "@cname()",
        "photo|1": img,
        'mobile': /^1[35789][1-9]\d{8}/,
        "intro": "@cparagraph()",
        "gender|0-1": 0,
        'area': '@county(true)',
        'address': '@county(true)@cword(4,7)小区'
      }
    }))
  },

  // 用户关注的公司列表
  [`GET  /app/user/company`](req, res) {
    Mock.Random.extend({
      // 定义随机的标签数组
      constellations: ['环境优美', '协会成员', '金牌家政', '服务好', '快速上门', '效率高'],
      //自定义占位符名字tags
      tags: function (date) {
        //随机选择2个作为返回值
        //return this.pick(this.constellations, 2)
        //随机选择2-4个作为返回值
        return this.pick(this.constellations, 1, 3)
      },
    })
    res.status(200).json(Mock.mock({
      message: '获取关注公司列表成功',
      data: {
        page: 1,
        per_page: 10,
        'results|4-20': [{
          // 公司随机id
          'com_id|1-9999': 1,
          // 公司名称
          'com_name': '@province(true)@ctitle(3,4)公司',
          // 公司目标
          "aim": '@cword(10,15)',
          // 标签
          'tag': '@tags',
          // 公司地址
          'com_address': '@county(true)@cword(3,5)写字楼',
          // 图片
          'images|1': img
        }]
      }
    }))
  },

  // 用户关注的家服人员列表 
  [`GET  /app/user/service`](req, res) {
    res.status(200).json(Mock.mock({
      message: '获取关注家服人员成功',
      data: {
        page: 1,
        per_page: 10,
        'results|4-20': [{
          // 服务人员id
          'ser_id|1-9999': 1,
          // 服务人员名字
          'ser_name': '@cname(2-4)',
          // 工资
          "salary|3000-12000": 3000,
          // 服务人员的标签
          'tag|1': [
            { "experience|1": ['1年经验', '2年经验', '3年经验', '4年经验', '5年经验', '6年经验', '7年经验', '8年经验'], 'grade|1': ['一星育婴师', '二星育婴师', '二星育婴师', '三星育婴师', '四星育婴师', '五星育婴师', '金牌育婴师'] },
          ],
          // 公司地址
          'com_address|1': ['湖南长沙', '广东广州', '湖南娄底', '广东深圳', '陕西铜川', '山东淄博', '江苏徐州', '福建三明', '福建南平'],
          // 图片
          'images|1': img,
          // 年龄
          'age|2': /[3-5]/,
          // 服务户数
          'standard|4-30': 1,
          // 评论总数
          'comment_total|5-999': 1

        }]
      }
    }))
  },
  // 已联系家政人员 
  [`GET /app/user/contacted`](req, res) {
    res.status(200).json(Mock.mock({
      message: '请求已联系人员列表成功',
      data: {
        page: 1,
        per_page: 5,
        "results|1-10": [{
          'ser_id|1-9999': 1,
          'ser_name': '@cname(2,4)',
          'mobile': /^1[35789][1-9]\d{8}/,
          'tag|1': [
            { "experience|1": ['1年经验', '2年经验', '3年经验', '4年经验', '5年经验', '6年经验', '7年经验', '8年经验'], 'grade|1': ['一星育婴师', '二星育婴师', '二星育婴师', '三星育婴师', '四星育婴师', '五星育婴师', '金牌育婴师'] },
          ],
          'company': '@province(true)@ctitle(3,4)公司',
          'images|1': img
        }]
      }
    }))
  },
  // 找家政服务
  [`POST /app/user/seekserve`](req, res) {
    res.status(200).json(Mock.mock({
      message: '请求成功',
      data: {
        'post': [1, 3, 5, 7],
        'mobile': /^1[35789][1-9]\d{8}/,
        'age|2': /[3-5]/,
        "salary|3000-12000": 3000,
        'is_reside|1-0': 0,
        'contacts': '@cname(2-4)',
        'native_place|1': ['汉', '维吾尔族', '苗族', '土家族', '蒙古族', '回族'],
        'address': '@county(true)@cword(4,7)小区',
      }
    }))
  }
};
